# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-kr-pty
pkgver=1.1.6
pkgrel=2
pkgdesc='PTY interface for Go'
arch=('any')
url="https://github.com/kr/pty"
license=('MIT')
depends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/kr/pty/archive/v$pkgver.tar.gz")
sha512sums=('d2fb6b0f4f980ff0135a34db1e9f4fe8ee31df47f19462b804a6979447752107965c1836409359ea85c6d3cdef6e106ac8bd1bb264e09954d9d85f40f57d0c48')

check() {
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/kr
  cp -a "$srcdir"/pty-$pkgver "$srcdir"/build/src/github.com/kr/pty
  cd "$srcdir"/build/src/github.com/kr/pty
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/kr
  cp -a "$srcdir"/pty-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/kr/pty

  install -Dm644 pty-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
